package edu.pku.sei.modeler.uml.obsolete.fromeditpolicies;

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.requests.CreateConnectionRequest;

import edu.pku.sei.modeler.editpolicies.UMLDiagramNodeEditPolicy;
import edu.pku.sei.modeler.model.structure.MetaLink;
import edu.pku.sei.modeler.model.structure.MetaNode;
import edu.pku.sei.modeler.uml.commands.UMLConnectionCreateCommand;
import edu.pku.sei.modeler.uml.commands.usecase.UseCaseDiagramConnectionCreateFactory;

/**
 * 
 * @author zsj
 * 
 */
public class UseCaseNodeEditPolicy extends UMLDiagramNodeEditPolicy {

	@Override
	protected Command getConnectionCreateCommand(CreateConnectionRequest request) {

		MetaLink link = (MetaLink) request.getNewObject();

		UMLConnectionCreateCommand command = UseCaseDiagramConnectionCreateFactory.INSTANCE
				.createCommand(link, (MetaNode) getHost().getModel());
		request.setStartCommand(command);
		return command;
	}

}
